package com.jzoffer2;

import java.util.Scanner;

/**
 * TODO
 *
 * @author lefly
 * @version 1.0
 * @classname No58_2
 * @description https://leetcode-cn.com/problems/zuo-xuan-zhuan-zi-fu-chuan-lcof/
 * @date 2021/2/7 下午12:58
 */
public class No58_2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String sentence = sc.nextLine();
        int n = sc.nextInt();
        String res = reverseLeftWords(sentence,n);
        System.out.println(res);
    }

    public static String reverseLeftWords(String s, int n) {
        if(s == null || s.length() == 0 || n == 0){
            return s;
        }
        int len = s.length();
        String pre = s.substring(0,n);
        String end = s.substring(n);
        return end + pre;
    }

}